/*
 * Created on 27/02/2004
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package org.potiorb.orb.invoke;

import java.util.HashMap;

import org.potiorb.orb.portable.ObjectRef;
import org.potiorb.orb.iiop.EndPoint;

public class EndPointManager {
	private HashMap EndPoints;

	public EndPointManager(){
		EndPoints = new HashMap();
	}

	public EndPoint GetEndpoint(ObjectRef pObjectRef){
		EndPoint existEndPoint = (EndPoint)EndPoints.get(pObjectRef);
		if (existEndPoint == null)
		{
			this.CreateEndpoint(pObjectRef);
			return (EndPoint)EndPoints.get(pObjectRef);
		}
		else
			return existEndPoint;

	}
	public void CreateEndpoint(ObjectRef pObjectRef){
		EndPoint pEndpoint = new EndPoint(pObjectRef.getHost(),Integer.parseInt(pObjectRef.getPort()));
		EndPoints.put(pObjectRef, pEndpoint);
	}

}
